﻿using UnityEngine;
using SLua;


public class MainStart : MonoBehaviour {

	//static string Lua_Src_Path = "/UnityFun/lua/";

	LuaSvr l;

	void Start () {
		UIManager.Instance.Init ();
		AssetBundleManager.Instance.Init ();
		#if LUA_5_1
		Debug.Log("QAQ");
		#endif

		TestMain ();
		LuaTest ();
		//Debug.Log(Sproto.add(3, 3));
	}

	void LuaTest()
	{
		l = new LuaSvr();

		l.init(null, () =>
		{
			l.start("main_start");
			}, LuaSvrFlag.LSF_BASIC | LuaSvrFlag.LSF_EXTLIB | LuaSvrFlag.LSF_3RDDLL);
	}

	void TestMain(){

		var go = AssetBundleManager.Instance.LoadAssetBundleDirect ("panel1").MainAsset as GameObject;

		var panelPrefab = Instantiate(go, UIManager.Instance.UIRoot.transform) as GameObject;
		panelPrefab.transform.localPosition = Vector3.zero;

		var go2 = AssetBundleManager.Instance.LoadAssetBundleDirect ("panel1").MainAsset as GameObject;

		var panelPrefab2 = Instantiate(go2, UIManager.Instance.UIRoot.transform) as GameObject;
		panelPrefab2.transform.localPosition = new Vector3(500, 0);

	}
}
